home *** CD-ROM | disk | FTP | other *** search
- #include <MacTypes.h>
- #include <MemoryMgr.h>
- #include <Quickdraw.h>
- #include <WindowMgr.h>
- #include <EventMgr.h>
- #include <OSUtil.h>
- #include <ResourceMgr.h>
- #include <ToolboxUtil.h>
- #include <DeviceMgr.h>
-
- #define NULL (0L)
-
- extern void main ( void );
- extern WindowPtr OpenWindow ( char*, short, short, short, short );
- extern void DrawWindow ( WindowPtr, char * );
- extern void KillWindow ( WindowPtr );
-
- void
- main()
- {
- asm {
- movea.l a0,a4 ; get pointer to our globals
- move.w (a7)+,d0 ; pop off routine selector
- add.w d0,d0 ; double the selector
- add.w d0,d0 ; double it again
- lea @JumpTable,a0 ; get address of jump table
- jmp 0(a0,d0.w) ; jump to our entry
- JumpTable:
- jmp OpenWindow
- jmp DrawWindow
- jmp KillWindow
- }
- }
-
- WindowPtr
- OpenWindow ( stTitle, left, top, right, bottom )
- char stTitle[];
- short left, top, right, bottom;
- {
- Rect rect;
-
- SetRect ( &rect, left, top, right, bottom );
-
- return NewWindow(NULL,&rect,stTitle,TRUE,documentProc,-1L,TRUE,0L);
- }
-
- void
- DrawWindow ( pwind, stMessage )
- WindowPtr pwind;
- char stMessage[];
- {
- short h, v;
-
- SetPort ( pwind );
- v = (pwind->portRect.top + pwind->portRect.bottom)/2;
- h = (pwind->portRect.left + pwind->portRect.right)/2;
- h -= StringWidth(stMessage)/2;
-
- MoveTo ( h, v );
- DrawString ( stMessage );
- }
-
- void
- KillWindow ( pwind )
- WindowPtr pwind;
- {
- DisposeWindow ( pwind );
- }
-
-
-